﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Emporium_Web.Controls
{
    public partial class Calendario : System.Web.UI.UserControl
    {
        public string FechaSeleccionada
        {
            get
            {
                return txtFecha.Text;
            }
            set
            {
                txtFecha.Text = value;
            }
        }

        public bool Enabled
        {
            set
            {
                txtFecha.Enabled = value;
                imgCalendario.Visible = value;
            }
        }

        protected string _validationGroup;
        public string ValidationGroup
        {
            get
            {
                return _validationGroup;
            }
            set
            {
                _validationGroup = value;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            EstablecerValidaciones(!string.IsNullOrEmpty(ValidationGroup));
        }

        private void EstablecerValidaciones(bool blnValidation)
        {
            reqDescripcion.Enabled = blnValidation;
            reqDescripcion.ValidationGroup = ValidationGroup;
            reqDescripcion.ErrorMessage = Resources.MensajesValidacion.RequiredField;
        }
    }
}